<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>对数组的push方法进行增强</title>
  </head>
  <body>
    <script type="text/javascript" >
      let arr = [1,3,5,7]
      let arr2 = [2,4,6]
      
      // 增强开始

      // 将原始的方法保存一份
      const originPush = Array.prototype.push
      // 将自定义的函数（我们写的新函数）放在原型上并替换掉原始的
      Array.prototype.push = function(value){
        value += 1
        return originPush.call(this,value)
      }
      // 增强结束

      arr.push(9)
      // arr2.push(67)

    </script>
  </body>
</html>